package goreport

import "fmt"

// An analogue of function fmt.Print that records in Output.Fd.
// Thread safety is provided by Output.Mutex.
func Print(a ...any) (int, error) {
	Output.Mutex.Lock()
	defer Output.Mutex.Unlock()

	return fmt.Fprint(Output.Fd, a...)
}

// An analogue of function fmt.Printf that records in Output.Fd.
// Thread safety is provided by Output.Mutex.
func Printf(format string, a ...any) (int, error) {
	Output.Mutex.Lock()
	defer Output.Mutex.Unlock()

	return fmt.Fprintf(Output.Fd, format, a...)
}

// An analogue of function fmt.Println that records in Output.Fd.
// Thread safety is provided by Output.Mutex.
func Println(a ...any) (int, error) {
	Output.Mutex.Lock()
	defer Output.Mutex.Unlock()

	return fmt.Fprintln(Output.Fd, a...)
}
